import request from 'supertest';
import app from './WarehouseReceivingAPI'; // 假设你的 WarehouseReceivingAPI 文件名为 WarehouseReceivingAPI.ts

describe('Warehouse Receiving API', () => {
  it('should create a warehouse receiving order', async () => {
    const response = await request(app).post('/warehouse/receiving/create').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('入库单已创建');
  });

  it('should approve a warehouse receiving order', async () => {
    const response = await request(app).post('/warehouse/receiving/approve').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('入库单已审核');
  });

  it('should accept received goods', async () => {
    const response = await request(app).post('/warehouse/receiving/accept').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('商品已验收');
  });

  it('should shelve received goods', async () => {
    const response = await request(app).post('/warehouse/receiving/shelve').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('商品已上架');
  });

  it('should query warehouse receiving records', async () => {
    const response = await request(app).get('/warehouse/receiving/records');
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('入库记录查询成功');
  });
});
import request from 'supertest';
import app from './WarehouseShippingAPI'; // 假设你的 WarehouseShippingAPI 文件名为 WarehouseShippingAPI.ts

describe('Warehouse Shipping API', () => {
  it('should create a shipping order', async () => {
    const response = await request(app).post('/warehouse/shipping/create').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('出库单已创建');
  });

  it('should approve a shipping order', async () => {
    const response = await request(app).post('/warehouse/shipping/approve').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('出库单已审核');
  });

  it('should pick goods for shipping', async () => {
    const response = await request(app).post('/warehouse/shipping/pick').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('商品已拣货');
  });

  it('should package goods for shipping', async () => {
    const response = await request(app).post('/warehouse/shipping/package').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('商品已打包');
  });

  it('should confirm goods shipping', async () => {
    const response = await request(app).post('/warehouse/shipping/confirm').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('商品已出库');
  });
});
import request from 'supertest';
import app from './InventoryCheckAPI'; // 假设你的 InventoryCheckAPI 文件名为 InventoryCheckAPI.ts

describe('Inventory Check API', () => {
  it('should create an inventory check task', async () => {
    const response = await request(app).post('/inventory/check/create-task').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('盘点任务已创建');
  });

  it('should execute an inventory check', async () => {
    const response = await request(app).post('/inventory/check/execute').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('盘点已执行');
  });

  it('should resolve inventory check differences', async () => {
    const response = await request(app).post('/inventory/check/resolve-difference').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('盘点差异已处理');
  });

  it('should generate an inventory check report', async () => {
    const response = await request(app).get('/inventory/check/report');
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('盘点报告已生成');
  });

  it('should approve inventory check results', async () => {
    const response = await request(app).post('/inventory/check/approve').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('盘点结果已审核');
  });
});
import request from 'supertest';
import app from './InventoryTransferAPI'; // 假设你的 InventoryTransferAPI 文件名为 InventoryTransferAPI.ts

describe('Inventory Transfer API', () => {
  it('should create a transfer order', async () => {
    const response = await request(app).post('/inventory/transfer/create').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('调拨单已创建');
  });

  it('should approve a transfer order', async () => {
    const response = await request(app).post('/inventory/transfer/approve').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('调拨单已审核');
  });

  it('should confirm goods transfer out', async () => {
    const response = await request(app).post('/inventory/transfer/confirm-out').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('调出已确认');
  });

  it('should confirm goods transfer in', async () => {
    const response = await request(app).post('/inventory/transfer/confirm-in').send({});
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('调入已确认');
  });

  it('should query transfer records', async () => {
    const response = await request(app).get('/inventory/transfer/records');
    expect(response.status).toBe(200);
    expect(response.body.message).toBe('调拨记录查询成功');
  });
});